package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsCommentMapper;
import com.qf.pojo.DtsComment;
import com.qf.service.DtsCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Zwnan
 */
@Service
public class DtsCommentServiceImpl implements DtsCommentService {

    @Autowired
    private DtsCommentMapper dtsCommentMapper;

    @Override
    public IPage<DtsComment> findPage(Integer page, Integer limit, String sort, String order) {
        IPage<DtsComment> iPage = new Page<>(page,limit);

        return dtsCommentMapper.selectPage(iPage,new QueryWrapper<DtsComment>().eq("deleted", false));
    }

    @Override
    public void delete(DtsComment dtsComment) {
        dtsComment.setDeleted(true);
        dtsCommentMapper.updateById(dtsComment);
    }
}
